package com.biz.hunter.dao;

import org.springframework.stereotype.Repository;

import com.biz.hunter.db.entity.OrderInterview;
import com.biz.hunter.db.entity.OrderResume;
import com.biz.hunter.dbutil.BaseDAO;

@Repository
public class OrderInterviewDAO {
	private static final String SQL_GET_ID = "select * from tb_order_interview where id = ?";
	private static final String SQL_SAVE = "INSERT INTO tb_order_interview(openid, orderId,employeeId,hunterId,ordescId,file,intention,remark,createtime,updatetime) VALUES(?,?,?,?,?,?,?,?,?,?)";
	private static final String SQL_GET_ORDERID="select * from tb_order_interview where orderId=?";
	
	public OrderInterview getInterviewById(long Id) {
		return BaseDAO.queryForObject(OrderInterview.class, SQL_GET_ID, Id);
	}

	public OrderInterview getInterviewByOrderId(long orderId){
		return BaseDAO.queryForObject(OrderInterview.class, SQL_GET_ORDERID, orderId);
	}
	
	public long saveOrderInterview(OrderInterview interview) {
		if (interview == null) {
			return -1;
		}

		Long result = BaseDAO.save(SQL_SAVE, interview.getOpenid(), interview.getOrderId(),
				interview.getEmployeeId(),interview.getHunterId(),interview.getOrdescId(),
				interview.getFile(),interview.getRemark(),interview.getCreatetime(),interview.getUpdatetime());
		if (result != null) {
			return result.longValue();
		}
		return -1;
	}
	


}
